package cn.itcast.wushangxiantu.Fragment;

import android.annotation.SuppressLint;
import android.app.Fragment;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;

import cn.itcast.wushangxiantu.R;
import cn.itcast.wushangxiantu.ToastUtil;

@SuppressLint("ValidFragment")
public class LingshiChongzhu extends Fragment implements View.OnClickListener {
    private View view;
    private Context context;
    private TextView tvBiaoTi;
    private Button tvChongzhu1;
    private Button tvChongzhu2;
    private Button tvChongzhu3;
    private Button tvChongzhu4;
    private LinearLayout liNongYuan;
    private static String content;

    public static String getContent() {
        return content;
    }

    public LingshiChongzhu(Context context) {
        this.context = context;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {

        view = inflater.inflate(R.layout.fragment_lingshi_chongzhu, null);
        initView(view);
        return view;
    }

    private void initView(View view) {
        tvBiaoTi = (TextView) view.findViewById(R.id.tvBiaoTi);
        tvChongzhu1 = (Button) view.findViewById(R.id.tvChongzhu1);
        tvChongzhu2 = (Button) view.findViewById(R.id.tvChongzhu2);
        tvChongzhu3 = (Button) view.findViewById(R.id.tvChongzhu3);
        tvChongzhu4 = (Button) view.findViewById(R.id.tvChongzhu4);
        liNongYuan = (LinearLayout) view.findViewById(R.id.liNongYuan);

        tvChongzhu1.setOnClickListener(this);
        tvChongzhu2.setOnClickListener(this);
        tvChongzhu3.setOnClickListener(this);
        tvChongzhu4.setOnClickListener(this);

        content="正在用雷龙息";
       
    }

    @Override
    public void onClick(View v) {
        tvChongzhu1.setTextSize(16);
        tvChongzhu2.setTextSize(16);
        tvChongzhu3.setTextSize(16);
        tvChongzhu4.setTextSize(16);
        switch (v.getId()) {
            case R.id.tvChongzhu1:
                tvChongzhu1.setTextSize(28);
                content="正在用雷龙息";
               ToastUtil.toast(context,"使用雷龙息");
                break;
            case R.id.tvChongzhu2:
                tvChongzhu2.setTextSize(28);
                content="正在用炎雀火";
                ToastUtil.toast(context,"使用炎雀火");
                break;
            case R.id.tvChongzhu3:
                tvChongzhu3.setTextSize(28);
                content="正在用龟蛇毒";
                ToastUtil.toast(context,"使用龟蛇毒");
                break;
            case R.id.tvChongzhu4:
                tvChongzhu4.setTextSize(28);
                content="正在用寒虎煞";
                ToastUtil.toast(context,"使用寒虎煞");
                break;
        }
    }
}
